<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<link rel="stylesheet" href="../../styles/index.css">

	<style>
		.box1 {
			width: 200px;
			height: 200px;
			background: skyblue;
		}

		.box2 {
			/* width: 200px; */
			height: 100px;
			background: pink;
			/** 
			 * 现象：box2不设置width，box2的宽度会自适应父元素的宽度，不管你加
			 * margin/padding/border等等，box2的宽度始终是父元素的宽度，只会
			 * 压缩内容显示的区域
			 */
			padding: 5px;
			margin: 10px;
			border: solid 10px red;
		}
	</style>
</head>

<body>
	<div class="box box1">
		<div class="box box2">box2</div>
	</div>
</body>

</html>